โ– humdrum codex / sportsball
license AGPL-3.0
3.0 KB raw
id
TASK-006
title
Rich live game detail (box score, scorers)
status
๐Ÿ Done
assignee
created_date
2026-06-16 18:03
updated_date
2026-06-18 01:17
labels
feature
dependencies
priority
medium
ordinal
1000

Description

Extend the full-page detail view with ESPN summary endpoint (.../{sport}/{path}/summary?event={id}): goals/scorers + match events for soccer, box score for MLB/NBA/NHL/NFL. Own tea.Cmd keyed by game ID, refreshed while detail open.

Acceptance Criteria

Implementation Plan

  1. model: add GameDetail{Events []MatchEvent; Leaders []TeamLeaders} + MatchEvent{Clock,Type,Text,ShortText,Team string; Scoring bool; Athletes []string} + TeamLeaders{Abbr string; Leaders []Leader{Category,Athlete,Value}}. model still imports nothing internal.
  2. espn: new summary.go โ€” decode summary endpoint (keyEvents + leaders), add Client.Summary(ctx, league, eventID) returning model.GameDetail. Map soccer keyEvents->MatchEvent, leaders->TeamLeaders.
  3. ui/commands.go: detailMsg{ID,Data,Err} + fetchDetail(client,league,id) cmd.
  4. ui/app.go: App.detailData map[string]model.GameDetail + detailErr; handle detailMsg; on pollMsg when mode==detail also fetchDetail (auto-refresh, no new tick loop).
  5. ui/update.go: on Enter fire fetchDetail; on manual refresh in detail fire fetchDetail too.
  6. ui/detail.go: render eventsBlock (soccer: goals/cards/subs timeline, team-colored) and leadersBlock (other sports) below metaBlock.
  7. espn test: add TestSummary against in-memory fixture (offline).

Final Summary

Added rich game detail via ESPN summary endpoint.

What changed:

Tests: TestMapSummarySoccerEvents + TestMapSummaryBoxScore (offline fixtures). Verified live decode end-to-end against EPL (goals+assists) and NFL (full box score) with a throwaway test, then deleted it. go build/vet/test all clean.

User impact: opening a game now shows scorers/key events (soccer) or full box scores (other leagues), refreshing live while open.